import { createMiniCode } from "@/utils/dynamicConfig";

export type EmitShowCustomShareType = 'invite' | 'relevancy';

const codeGuideImg2 =
  'https://hb-saas.obs.cn-south-1.myhuaweicloud.com/mall/saas/code-guide-img2.png';

/**
 * @description 邀请入会的海报数据
 * @date 19/07/2024
 * @export
 * @param {string} posterImg
 */
export async function getInviteJoinPosterData(posterImg: string, shareLogId: number): Promise<PainterBoard> {
  const posterWidth = 690;
  const width = 650;
  const height = 854;
  const codeImg = await createMiniCode({ shareLogId });
  return {
    css: {
      width: posterWidth + 'rpx',
      background: '#fff',
    },
    views: [
      {
        src: posterImg,
        type: 'image',
        css: {
          width: width + 'rpx',
          height: height + 'rpx',
          marginLeft: posterWidth / 2 - width / 2 + 'rpx',
          marginTop: '20rpx',
          objectFit: 'contain',
        },
      },
      {
        type: 'view',
        css: {
          width: posterWidth + 'rpx',
          height: '273rpx',
          background: '#fff',
        },
        views: [
          {
            type: 'image',
            src: codeGuideImg2,
            css: {
              width: '420rpx',
              height: '144rpx',
              marginLeft: '30rpx',
              marginTop: '45rpx',
            },
          },
          {
            type: 'image',
            src: codeImg,
            css: {
              width: '158rpx',
              height: '158rpx',
              position: 'absolute',
              right: '40rpx',
              top: '50rpx',
            },
          },
        ],
      },
    ],
  };
}